using Business.Models;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;

namespace Business.EntityFrameworkCore
{
    public static class BusinessDbContextModelCreatingExtensions
    {
        public static void ConfigureBusiness(this ModelBuilder builder)
        {
            Check.NotNull(builder, nameof(builder));

            builder.Entity<Book>(b =>
            {
                b.ToTable("Book");

                b.ConfigureByConvention();

                b.Property(x => x.Name).IsRequired();

        
            });

            //��Ӧ��
            builder.Entity<Dstributor>(b =>
            {
                b.ToTable("Dstributor");

                b.ConfigureByConvention();

                b.Property(x => x.DstriName).IsRequired();

        
            });

            builder.Entity<AssembleInfo>(b =>
            {
                b.ToTable("AssembleInfo");

                b.ConfigureByConvention();

                b.Property(x => x.Assemblenumber).IsRequired();


            });
             
            builder.Entity<AssPro>(b =>
            {
                b.ToTable("AssPro");

                b.ConfigureByConvention();

                b.Property(x => x.cpname).IsRequired();


            });

            builder.Entity<Dstributor>(b =>
            {
                b.ToTable("Dstributor");

                b.ConfigureByConvention();

                b.Property(x => x.DstriName).IsRequired();


            });
            builder.Entity<Sale>(b =>
            {
                b.ToTable("Sale");

                b.ConfigureByConvention();

                b.Property(x => x.Suname).IsRequired();


            });

            builder.Entity<SaPro>(b =>
            {
                b.ToTable("SaPro");

                b.ConfigureByConvention();

                b.Property(x => x.Saname).IsRequired();


            });


            //库存上下限
            builder.Entity<Inventory>(b =>
            {
                b.ToTable("Inventory");

                b.ConfigureByConvention();

                b.Property(x => x.Iname).IsRequired();


            });

            //��Ʒ
            builder.Entity<Produce>(b =>
            {
                b.ToTable("Produce");

                b.ConfigureByConvention();

                b.Property(x => x.ProName).IsRequired();


            });

            //ѯ��
            builder.Entity<Purch>(b =>
            {
                b.ToTable("Purch");

                b.ConfigureByConvention();

                b.Property(x => x.Source).IsRequired();


            });

            //供应商
            builder.Entity<Supplier>(b =>
            {
                b.ToTable("Supplier");

                b.ConfigureByConvention();

                b.Property(x => x.Sname).IsRequired();


            });

            builder.Entity<Pricing>(b =>
            {
                b.ToTable("Pricing");

                b.ConfigureByConvention();

                b.Property(x => x.Associated).IsRequired();


            });

            builder.Entity<PrintTemplate>(b =>
            {
                b.ToTable("base_print_template");

                b.ConfigureByConvention();
                
                b.Property(x => x.Name).IsRequired();
            });

            #region  入库新表(启用）

            //入库单
            builder.Entity<AddWarehouse>(b =>
            {
                b.ToTable("AddWarehouse");

                b.ConfigureByConvention();

                b.Property(x => x.Name).IsRequired();
            });
            //入库明细表
            builder.Entity<AddWarehouseList>(b =>
            {
                b.ToTable("AddWarehouseList");

                b.ConfigureByConvention();

                b.Property(x => x.SpName).IsRequired();
            });
            //确认表
            builder.Entity<AddConfirmForm>(b =>
            {
                b.ToTable("AddConfirmForm");

                b.ConfigureByConvention();

                b.Property(x => x.AWName).IsRequired();
            });

            //仓库表
            builder.Entity<Warehouses>(b =>
            {
                b.ToTable("Warehouses");

                b.ConfigureByConvention();

                b.Property(x => x.ShoppingName).IsRequired();
            });




            #endregion


            #region  入库旧表（弃用）

            //��ⵥ
            builder.Entity<Storage>(b =>
            {
                b.ToTable("Storage");

                b.ConfigureByConvention();

                b.Property(x => x.Name).IsRequired();


            });
            //��ⵥ��ϸ
            builder.Entity<StorageList>(b =>
            {
                b.ToTable("StorageList");

                b.ConfigureByConvention();

                b.Property(x => x.ShoppName).IsRequired();


            });
            builder.Entity<OutStorage>(b =>
            {
                b.ToTable("OutStorage");

                b.ConfigureByConvention();

                b.Property(x => x.Name).IsRequired();


            });
            builder.Entity<OutStorageList>(b =>
            {
                b.ToTable("OutStorageList");

                b.ConfigureByConvention();

                b.Property(x => x.ShoppName).IsRequired();


            });
            #endregion






            #region 产品

            builder.Entity<Product>(b =>
            {
                b.ToTable("Product");

                b.ConfigureByConvention();

                b.Property(x => x.PName).IsRequired();


            });

            builder.Entity<ProductsType>(b =>
            {
                b.ToTable("ProductsType");

                b.ConfigureByConvention();

                b.Property(x => x.ProductsTypeName).IsRequired();


            });

            builder.Entity<ProductCuring>(b =>
            {
                b.ToTable("ProductCuring");

                b.ConfigureByConvention();

                b.Property(x => x.DocumentName).IsRequired();


            });

            builder.Entity<ProductDetails>(b =>
            {
                b.ToTable("ProductDetails");

                b.ConfigureByConvention();

                b.Property(x => x.ProductName).IsRequired();


            });

            #endregion

            #region 调拨

            builder.Entity<Allocate>(b =>
            {
                b.ToTable("Allocate");

                b.ConfigureByConvention();

                b.Property(x => x.DocumentSubject).IsRequired();


            });
            builder.Entity<AllocationDetails>(b =>
            {
                b.ToTable("AllocationDetails");

                b.ConfigureByConvention();

                b.Property(x => x.ProductName).IsRequired();


            });








            builder.Entity<DatabaseSum>(b =>
            {
                b.ToTable("DatabaseSum");

                b.ConfigureByConvention();

                b.Property(x => x.DocumentName).IsRequired();


            });
            builder.Entity<AllocationDesc>(b =>
            {
                b.ToTable("AllocationDesc");

                b.ConfigureByConvention();

                b.Property(x => x.ProductName).IsRequired();


            });
            builder.Entity<PreciseLibrary>(b =>
            {
                b.ToTable("PreciseLibrary");

                b.ConfigureByConvention();

                b.Property(x => x.DocumentName).IsRequired();


            });
            builder.Entity<SumTransfers>(b =>
            {
                b.ToTable("SumTransfers");

                b.ConfigureByConvention();

                b.Property(x => x.ProductName).IsRequired();


            });



            #endregion

            #region 借款
            builder.Entity<BorrowM>(b =>
            {
                b.ToTable("BorrowM");

                b.ConfigureByConvention();

                b.Property(x => x.BTitle).IsRequired();

            });

            builder.Entity<BorrowPro>(b =>
            {
                b.ToTable("BorrowPro");

                b.ConfigureByConvention();

                b.Property(x => x.PName).IsRequired();

            });
            builder.Entity<CheckDetail>(b =>
            {
                b.ToTable("CheckDetail");

                b.ConfigureByConvention();

                b.Property(x => x.CDTitle).IsRequired();

            });
            builder.Entity<CheckPlan>(b =>
            {
                b.ToTable("CheckPlan");

                b.ConfigureByConvention();

                b.Property(x => x.CPName).IsRequired();

            });
            builder.Entity<CheckQ>(b =>
            {
                b.ToTable("CheckQ");

                b.ConfigureByConvention();

                b.Property(x => x.CName).IsRequired();

            });
            builder.Entity<Deliverys>(b =>
            {
                b.ToTable("Deliverys");

                b.ConfigureByConvention();

                b.Property(x => x.DName).IsRequired();

            });
            builder.Entity<GoodCom>(b =>
            {
                b.ToTable("GoodCom");

                b.ConfigureByConvention();

                b.Property(x => x.GComName).IsRequired();

            });
            builder.Entity<InDetail>(b =>
            {
                b.ToTable("InDetail");

                b.ConfigureByConvention();

                b.Property(x => x.ProductName).IsRequired();

            });
            builder.Entity<Inven>(b =>
            {
                b.ToTable("Inven");

                b.ConfigureByConvention();

                b.Property(x => x.ITitle).IsRequired();

            });
            builder.Entity<RGoods>(b =>
            {
                b.ToTable("RGoods");

                b.ConfigureByConvention();

                b.Property(x => x.RTitle).IsRequired();

            });

            builder.Entity<RDetail>(b =>
            {
                b.ToTable("RDetail");

                b.ConfigureByConvention();

                b.Property(x => x.RPName).IsRequired();

            });

            builder.Entity<SendG>(b =>
            {
                b.ToTable("SendG");

                b.ConfigureByConvention();

                b.Property(x => x.STitle).IsRequired();

            });

            builder.Entity<SendInfo>(b =>
            {
                b.ToTable("SendInfo");

                b.ConfigureByConvention();

                b.Property(x => x.SIPeo).IsRequired();

            });

            builder.Entity<SendDetail>(b =>
            {
                b.ToTable("SendDetail");

                b.ConfigureByConvention();

                b.Property(x => x.DName).IsRequired();

            });



            #endregion

            //Code generation...
        }
    }
}
